const React = require('react');
const MasterComponent=require('./bookMaster.jsx');
const BookHomePage=require('./bookHomePage.jsx');
const BookCategory=require('./bookCategory.jsx');
const BookChapterList=require('./bookChapterList.jsx');
const BookChapter=require('./bookChapter.jsx');
const BookSearchList=require('./bookSearchList.jsx');

const AppTodo=require('./app.jsx');
const Login=require('./login.jsx');

import{Router,Route,hashHistory,IndexRoute} from 'react-router';

var App = React.createClass({
	getInitialState: function() {
		return {
		  todolist: []
		};
	},
	getDefaultProps: function() {
    	return {
	      uid: 0
	    };
  	},	
  	render: function () {
	    return (
	       <Router history={hashHistory}>
	       <Route path="/todo/:uid" component={AppTodo} />
			<Route path="/login" component={Login} />
			<Route path="/" component={MasterComponent} >
				<IndexRoute component={BookHomePage}/>
				<Route path="category/:typeid" component={BookCategory} />
				<Route path="chapterlist/:bookid" component={BookChapterList} />
				<Route path="chapter/:bookid/:chapterid" component={BookChapter} />
				<Route path="search(/:keyword)" component={BookSearchList} />
			</Route>
			
		</Router>     
	    );
	  }
});

module.exports = App;
